package com.platform.server.util.excel;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by len.song on 2017/7/4.
 */
public class InvitationCode {
    private static Logger logger = LoggerFactory.getLogger(InvitationCode.class);

    @Excel(exportName="手机号",exportFieldWidth=18,exportConvertSign=0,importConvertSign=0)
    private String mobile;

    public static List<String> getMobileIds(String path){
        List<String> lists = new ArrayList<String>();
        ExcelImport test = new ExcelImport();
        File file = new File(path);
        Long befor = System.currentTimeMillis();
        @SuppressWarnings("unchecked")
        List<InvitationCode> result = (ArrayList<InvitationCode>) test.importExcel(file, InvitationCode.class);

        Long after = System.currentTimeMillis();
        logger.info("此次操作共耗时：" + (after - befor) + "毫秒");

        for (int i = 0; result!=null && i < result.size(); i++) {
            InvitationCode xmOrderNo = result.get(i);
            logger.info("导入的信息为：" + xmOrderNo.getMobile());
            lists.add(xmOrderNo.getMobile());
        }

        logger.info("共转化为List的行数为：" + result.size());

        return lists;
    }


    public static Logger getLogger() {
        return logger;
    }

    public static void setLogger(Logger logger) {
        InvitationCode.logger = logger;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
}
